<template>
  <div>
    {{ user.name }}
    {{ user.score }}
    {{ num }}
    <van-button type="primary" @click="handleNum(10)"></van-button>
  </div>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import type { PropType } from "vue";
import { ref } from "vue";
interface User {
  name: string;
  score: number;
}
export default defineComponent({
  props: {
    user: {
      type: Object as PropType<User>,
      required: true,
    },
  },
  setup() {
    let num = ref<number>(0);
    const handleNum = (n: number) => {
      num.value += n;
    };
    return {
      num,
      handleNum,
    };
  },
});
</script>

<style scoped></style>
